package cn.t.keycloak.demo.mfa.sms.credential;

import lombok.extern.slf4j.Slf4j;
import org.keycloak.Config;
import org.keycloak.credential.CredentialProvider;
import org.keycloak.credential.CredentialProviderFactory;
import org.keycloak.models.KeycloakSession;

/**
 * 扩展用户凭证表的接口
 * @author 陶敏麒
 * @date 2023/11/15 16:18
 */
@Slf4j
public class SmsCredentialProviderFactory implements CredentialProviderFactory<SmsCredentialProvider> {

    public static final String PROVIDER_ID = "sms_credential";
    @Override
    public CredentialProvider<SmsCredentialModel> create(KeycloakSession keycloakSession) {
        return new SmsCredentialProvider(keycloakSession);
    }

    @Override
    public String getId() {
        return PROVIDER_ID;
    }

    @Override
    public void init(Config.Scope config) {
        log.info(">>>>>>SmsCredentialProviderFactory开始初始化");
    }
}
